/**
 * author: MaHX
 * date: 2019/8/18/23:58
 * description: 栈定义
 **/
public class MyStack {
    int size = 0;
    Node head = null;
    public void push(Object value){
        Node newNode = new Node(value);
            newNode.setNext(head);
            head = newNode;
            size++;
    }
    public void pop(){
        head = head.getNext();
        size--;
    }
    public int size(){
        return size;
    }
    public Object get(int index){
        Node temp = head;
        for (int i = 0; i < index; i++) {
            temp = temp.getNext();
        }
        return temp.getValue();

    }
}
